﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Galoap
{
    public class QuestionText
    {

        public string Prefix { get; set; }
        public string Suffix { get; set; }
        public string Terminator { get; set; }

        // protected Category QuestionCategory;
        // protected string attribute;

        /// <summary>
        /// creates a QuestionText without a text (the "." string)
        /// </summary>
        public QuestionText()
        {
            Prefix = String.Empty;
            Suffix = String.Empty;
            Terminator = ".";
        }

        /// <summary>
        /// creates a QuestionText with a text
        /// </summary>
        /// <param name="text">the text in the QuestionText</param>
        public QuestionText(string text)
        {
            Prefix = text;
            Suffix = String.Empty;
            Terminator = String.Empty;
        }

        /// <summary>
        /// creates a QuestionText with a text
        /// </summary>
        /// <param name="header">the initial part of the text in the QuestionText</param>
        /// <param name="bottom">the final part of the text in the QuestionText</param>
        public QuestionText(string header, string bottom)
        {
            Prefix = header;
            Suffix = String.Empty;
            Terminator = bottom;
        }

        /// <summary>
        /// creates a QuestionText with a text
        /// </summary>
        /// <param name="header">the initial part of the text in the QuestionText</param>
        /// <param name="footer">the central part of the text in the QuestionText</param>
        /// <param name="bottom">the final part of the text in the QuestionText</param>
        public QuestionText(string header, string footer, string bottom)
        {
            Prefix = header;
            Suffix = footer;
            Terminator = bottom;
        }

        /// <summary>
        /// method which returns a string representing the QuestionText in a generic format
        /// </summary>
        /// <returns>the string representing the QuestionText</returns>
        public virtual string GetQuestionText()
        {
            if (Suffix.Equals(String.Empty))
                if (Prefix.Equals(String.Empty))
                    return String.Empty;
                else 
                    return Prefix + Terminator;
            else
                return Prefix + " " + Suffix + Terminator;
        }

        /// <summary>
        /// method which returns a string representing the QuestionText in a confirm format 
        /// </summary>
        /// <param name="attribute">the attribute which the question asks a confirm</param>
        /// <param name="count">a number that indicate if there are singular or plural consens with the confirm required</param>
        /// <returns>the string representing the QuestionText</returns>
        public virtual string GetConfirmQuestionText(string answer)
        {
            return "Alcuni utenti hanno fornito la risposta \'" + answer + "\', sei d'accordo con loro?";
        }


    }
}
